

employees = []  # 用于存储员工信息的列表


def add():
    """添加员工信息"""
    employee_id = input("请输入学号: ")
    name = input("请输入姓名: ")
    gender = input("请输入性别: ")
    class_name = input("请输入部门: ")
    employee = {
        "学号": employee_id,
        "姓名": name,
        "性别": gender,
        "部门": class_name
    }
    employees.append(employee)
    print("员工信息添加成功！")


def delete():
    """删除员工信息"""
    employee_id = input("请输入要删除的员工学号: ")
    for employee in employees:
        if employee["学号"] == employee_id:
            employees.remove(employee)
            print("员工信息删除成功！")
            return
    print("找不到该员工的信息！")


def update():
    """修改员工信息"""
    employee_id = input("请输入要修改的员工学号: ")
    for employee in employees:
        if employee["学号"] == employee_id:
            employee["姓名"] = input("请输入修改后的姓名: ")
            employee["性别"] = input("请输入修改后的性别: ")
            employee["部门"] = input("请输入修改后的部门: ")
            print("员工信息修改成功！")
            return
    print("找不到该员工的信息！")


def select():
    """查询所有员工信息"""
    if len(employees) == 0:
        print("暂无员工信息！")
        return
    print("员工信息如下:")
    for employee in employees:
        print(f"学号: {employee['学号']}, 姓名: {employee['姓名']}, 性别: {employee['性别']}, 部门: {employee['部门']}")




def main():
    """主函数，控制程序运行流程"""
    while True:
        print("欢迎使用员工管理系统")
        print("1. 添加员工信息")
        print("2. 删除员工信息")
        print("3. 修改员工信息")
        print("4. 查询所有员工信息")
        print("5. 退出系统")
        choice = input("请输入功能序号: ")
        if choice == "1":
            add()
        elif choice == "2":
            delete()
        elif choice == "3":
            update()
        elif choice == "4":
            select()
        elif choice == "5":
            print("感谢使用员工管理系统，再见！")
            break
        else:
            print("无效的选择，请重新输入！")

# main()